<!DOCTYPE html>
<html lang="zh-CN">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
        <meta name="description" content="">
        <meta name="author" content="">

        <title>后台</title>

		<link href="__PUBLIC__/images/favicon.ico" rel="shortcut icon" />

        <!-- Bootstrap core CSS -->
        <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css" />
        <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-theme.min.css" />
        <link rel="stylesheet" href="__PUBLIC__/css/dashboard.css" />
        <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-switch.css" />
        <link rel="stylesheet" href="__PUBLIC__/css/icheck/all.css" />

    </head>

    <body>

        <include file="Common/topNav" />

        <div class="container-fluid">
            <div class="row">
                <include file="Common/leftMenu" />
                <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                	<div class="cont-title clearfix">
						<div class="title">创空间统计信息</div>
					</div>
                    <form class="jc-search form-inline" action="{:U('Admin/Space/Index/index')}" method="post" id="queryForm">
                        <div class="form-group">
                            <label>所属空间：</label>
                            <select class="form-control" name="spaceId" id="spaceId">
                                <option value="" <if condition="$spaceId eq ''">selected</if>>全部</option>
                                <foreach name="spaceList" item="space">
                                    <option value="{$space.id}" <if condition="$spaceId eq $space['id']">selected</if>>{$space.name}</option>
                                </foreach>
                            </select>
                        </div>
                    </form>
                    <div class="table-responsive main-box row">
                    	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    		<div class="main-item">
								<h3 class="tit">统计信息<i class="icon"></i></h3>
								<div class="info-box clearfix">
									<div class="info-item">
										<div class="info-btn info-btn1">
											<div class="content">
												<h3 class="title">工位数量</h3>
												<p class="num">{$stationCount}</p>
											</div>
										</div>
									</div>
									<div class="info-item">
										<div class="info-btn info-btn2">
											<div class="content">
												<h3 class="title">会议室数量</h3>
												<p class="num">{$meetingRoomCount}</p>
											</div>
										</div>
			                        </div>
			                        <div class="info-item">
			                        	<div class="info-btn info-btn3">
			                        		<div class="content">
				                        		<h3 class="title">会议预约数量</h3>
				                        		<p class="num">{$meetingOrderCount}</p>
			                        		</div>
			                        	</div>
			                        </div>
			                        <div class="info-item">
			                        	<div class="info-btn info-btn4">
			                        		<div class="content">
				                        		<h3 class="title">已入住团队数量</h3>
				                        		<p class="num">{$teamCount}</p>
			                        		</div>
			                        	</div>
			                        </div>
								</div>
							</div> 
	                    </div>
	                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	                    	<div class="main-item">
								<h3 class="tit">快捷入口<i class="icon"></i></h3>
								<div class="quick-box clearfix" style="padding-bottom: 5px;">
									<div class="quick-item">
										<div class="quick-btn quick-btn6" id="station_btn">添加工位</div>
									</div>
									<div class="quick-item">
										<div class="quick-btn quick-btn7" id="office_room_btn">添加独立工作区</div>
									</div>
									<div class="quick-item">
										<div class="quick-btn quick-btn1" id="meeting_room_btn">添加会议室</div>
									</div>
									<div class="quick-item">
										<div class="quick-btn quick-btn2" id="meeting_order_btn">添加会议预约</div>
									</div>
									<div class="quick-item">
										<div class="quick-btn quick-btn3" id="team_btn">添加入驻团队</div>
									</div>
									<div class="quick-item">
										<div class="quick-btn quick-btn4" id="space_user_btn">添加用户</div>
									</div>
									<div class="quick-item">
										<div class="quick-btn quick-btn5" id="company_btn">添加企业</div>
									</div>
								</div>
							</div>
	                    </div>
	
	                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	                    	<div class="main-item">
								<h3 class="tit">最新通知<i class="icon"></i><a class="more-btn" href="{:U('Admin/Space/Notice/index')}">更多&gt;&gt;</a></h3>
								<div class="table2-box">
									<table class="table2" id="tableData">
			                            <tbody>
			                                <foreach name="noticeList" item="notice">
			                                    <tr>
			                                        <td class="notice_detail" thisId="{$notice.id}" link="{$notice.link}">
														<if condition="$notice['link']">
															<a href="javascript:void(0);">{$notice.title}</a>
														<else/>
															{$notice.title}
														</if>
			                                        </td>
			                                        <td class="tr">{$notice.create_time|date="Y-m-d H:i",###}</td>
			                                    </tr>
			                                </foreach>
			                            </tbody>
			                        </table>
								</div>
							</div>  
	                    </div>
                    </div>
	                    
                </div>
            </div>
        </div>
        <include file="Common/modalHtmls" />
        <script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/bootstrap-switch.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/icheck.min.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/bootstrap-datetimepicker.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/validator.min.js"></script>

        <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/vendor/jquery.ui.widget.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-ui.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.iframe-transport.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-process.js"></script>
        <script type="text/javascript">
            
            $(function () {
                $("#station_btn").bind("click",addStation);
                $("#office_room_btn").bind("click",addOffice);
                $("#meeting_room_btn").bind("click",addMeetingRoom);
                $("#meeting_order_btn").bind("click",addMeetingOrder);
                $("#team_btn").bind("click",addTeam);
                $("#space_user_btn").bind("click",addUser);
                $("#company_btn").bind("click",addCompany);
                $("#spaceId").bind("change",reloadData);
                $("#tableData .notice_detail").click(function(){
                    showNotice(this);
                });
            });

            function addStation(){
                common.loading('正在加载...');
                common.htmlAjax("{:U('Admin/Space/Spaces/addStation')}", {}, function (html) {
                    common.closeLoading();
                    if(common.isJsonString(html)){
                        var error = JSON.parse(html);
                        if (error.info){
                            common.alert("提示",error.info);
                        }
                        return;
                    }
                    $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
                });
            }

            function addOffice(){
                common.loading('正在加载...');
                common.htmlAjax("{:U('Admin/Space/Spaces/addOfficeRoom')}", {}, function (html) {
                    common.closeLoading();
                    if(common.isJsonString(html)){
                        var error = JSON.parse(html);
                        if (error.info){
                            common.alert("提示",error.info);
                        }
                        return;
                    }
                    $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
                });
            }
            
            function addMeetingRoom(){
                common.loading('正在加载...');
                common.htmlAjax("{:U('Admin/Space/MeetingRoom/add')}", {}, function (html) {
                    common.closeLoading();
                    if(common.isJsonString(html)){
                        var error = JSON.parse(html);
                        if (error.info){
                            common.alert("提示",error.info);
                        }
                        return;
                    }
                    $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
                });
            }

            function addMeetingOrder(){
                common.loading('正在加载...');
                common.htmlAjax("{:U('Admin/Space/Meeting/add')}", {}, function (html) {
                    common.closeLoading();
                    if(common.isJsonString(html)){
                        var error = JSON.parse(html);
                        if (error.info){
                            common.alert("提示",error.info);
                        }
                        return;
                    }
                    $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
                });
            }

            function addTeam(){
                common.loading('正在加载...');
                common.htmlAjax("{:U('Admin/Space/Settled/addTeam')}", {}, function (html) {
                    common.closeLoading();
                    if(common.isJsonString(html)){
                        var error = JSON.parse(html);
                        if (error.info){
                            common.alert("提示",error.info);
                        }
                        return;
                    }
                    $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
                });
            }

            function addUser(){
                common.loading('正在加载...');
                common.htmlAjax("{:U('Admin/User/addUser')}", {}, function (html) {
                    common.closeLoading();
                    if(common.isJsonString(html)){
                        var error = JSON.parse(html);
                        if (error.info){
                            common.alert("提示",error.info);
                        }
                        return;
                    }
                    $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
                });
            }

            function addCompany() {
                common.loading('正在加载...');
                common.htmlAjax("{:U('Admin/Company/addCompany')}", {}, function (html) {
                    common.closeLoading();
                    if(common.isJsonString(html)){
                        var error = JSON.parse(html);
                        if (error.info){
                            common.alert("提示",error.info);
                        }
                        return;
                    }
                    $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
                });
            }

            function showNotice(obj) {
                var id = $(obj).attr("thisId");
                var link = $(obj).attr("link");
                if(link) {
                    location.href = link;
                    return;
                } else {
                    return;
				}
                common.loading('正在加载...');
                common.htmlAjax("{:U('Admin/Space/Notice/detail')}", {id:id}, function (html) {
                    common.closeLoading();
                    if(common.isJsonString(html)){
                        var error = JSON.parse(html);
                        if (error.info){
                            common.alert("提示",error.info);
                        }
                        return;
                    }
                    $("#commonModal").html(html).modal('toggle');
                });
            }
            
            function reloadData() {
                $("#queryForm").submit();
            }
            
        </script>
    </body>

</html>